﻿package {    import flash.display.Stage;    import flash.events.KeyboardEvent;         public class KeyDetector     {         		private static var pressedKeys:Array=[];		        public static function initialize(stageReference:Stage):void        {            stageReference.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);        }                 private static function onKeyDown(e:KeyboardEvent):void        {			trace("Key down!");						//var character:String = String.fromCharCode(e.charCode);			trace(e.keyCode);						if (e.keyCode == 8 || e.keyCode== 46)				{pressedKeys.pop();				trace("popping");				}			else				{pressedKeys.push(e.charCode);}						var output:String = "";			for (var i:int = 0; i < pressedKeys.length; i++) {				var char:String = String.fromCharCode(pressedKeys[i]);				output=output+char;			}			trace(output);			        }             } }